package pong.builders 
{
	import common.CompositeTest;
	import common.IApp;
	import common.IAppBuilder;
	import common.ICompositeTest;
	import common.ILogger;
	import common.IStateController;
	import common.ITest;
	import common.ITestBuilder;
	import common.StateController;
	import common.tests.AppBuilderTest;
	import common.tests.AppTest;
	import pong.app.builders.PongAppBuilder;
	/**
	 * ...
	 * @author Luke Van In
	 */
	public class PongTestBuilder implements ITestBuilder
	{
		private var _logger:ILogger;

		
		
		public function PongTestBuilder(logger:ILogger) 
		{
			this._logger = logger;
		}
		
		
		
		/**
		 * 
		 * @return
		 * @throws	Error	Error constructing subjects
		 */
		public function buildTest():ITest
		{
			// create test subjects
			try
			{
				var appBuilder:IAppBuilder = new PongAppBuilder();
			
				var app:IApp = appBuilder.buildApp();
				
				

				
				// create app controller
				var appController:IPongAppController = new PongAppController(appStateController);
				
			}
			catch (e:Error)
			{
				throw new Error("Error during construction: " + e);
			}
			
			
			// create test
			var tests:ICompositeTest = new CompositeTest("Pong");
			
			tests.addTest(new AppBuilderTest(appBuilder));
			
			tests.addTest(new AppTest(app));
			
			return tests;
		}
		
		
		
				
		
	}

}